layui.use("table",function () {

	var table=layui.table;

	var vm=new Vue({
		el:"#content",
		data:{
			times:{
				time1:"8:30--10:00",
				time2:"10:30--12:00",
				time3:"13:30--15:00",
				time4:"15:30--17:00"
			}
		},
	});

	//获取该教师Id
	var teaId=$("#myId").text();

	//获取该教师id的课程
	$.ajax({
		url:"getTeaCourseTable",
		type:"get",
		data:{
			"teaId":teaId,
		},
		dataType:"json",
		success:function(data){
			var times=["8:30-10:00","10:30-12:00","13:30-15:00","15:30-17:00"];
			$(data).each(function(i,course){
				$.each(course.trinityList,function(i,trinity){

					//指定该课程的位置
					var week="";
					var time="";

					for(var i=1;i<=7;i++){
						if(("星期"+i)==trinity.week){
							week="week"+i;
						}
					}

					for(var j=0;j<=3;j++){
						if((times[j])==trinity.time){
							time="time"+(j+1);
						}
					}

					//拼接显示位置信息
					var element="."+week+"."+time;

					//dom元素添加
					$(document).one("mouseover",document,function(){
						$(element).append(course.name+"<br>"+trinity.place+"<br>");
					});
				});
			});
		},

	});

})

